import java.util.List;

public class Test1 {
    public static void main(String[] args) {
        int arr[]=new int[432643];
        for(int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100000)+1;
        }
        long s=System.currentTimeMillis();

        A.quickSort(arr,0,arr.length-1);
        long e=System.currentTimeMillis();
        System.out.println(e-s);

    }
}

class A{
    public static void quickSort(int[]arr,int left,int right){
        if(left>=right){
            return;
        }
        int piv=pation(arr,left,right);
        quickSort(arr,left,piv-1);
        quickSort(arr,piv+1,right);
    }
    public static int pation(int[]arr,int start,int end){
        int i=start;
        int pivot=arr[start];
        while (start<end){
            while (start<end&&arr[end]>=pivot){
                end--;
            }
            while (start<end&&arr[start]<=pivot){
                start++;
            }
            swap(arr,start,end);
        }
        swap(arr,start,i);
        return start;

    }
    public static void swap(int[]arr,int i,int j){
        int tem=arr[i];
        arr[i]=arr[j];
        arr[j]=tem;
    }

}
